<template>
  <div>
    <find @find="queryProve"></find>

    <a-table
    ref="table"
    :columns="columns"
    :data-source="list"
    :rowKey="(record) => record.id"
    :pagination="pagination"
    >
        <template #headImg="text">
            <img :src="text" class="head-img">
        </template>

        <template #createTime="text">
            <span>{{ dataReset(text) }}</span>
        </template>

        <template #reviewStatus="text">
            <a-tag :color="text===-1?'red':(text===1?'green':'')">
                {{ text===0?"待处理":(text===1?"已通过":"未通过") }}
            </a-tag>
        </template>

        <template #do="text, record">
            <router-link :to="record.id+'/proveInfo' ">审核</router-link>
        </template>
    </a-table>
  </div>
</template>

<script>
import moment from "moment"
import Find from '@/components/Find.vue'
import { getProveList } from "@/api/user/Renz"

export default {
  components: { Find },
  data() {
      return {
           pagination:{
              pageSize: 9,
          },
          list: [],
          columns:[
            {
              title: "ID",
              dataIndex: "id",
              key: "id",
            },
            {
              title: "用户账号",
              dataIndex: "memberId",
              key: "memberId",
            },
            {
              title: "姓名",
              dataIndex: "realName",
              key: "realName",
            },
            {
              title: "昵称",
              dataIndex: "nickname",
              key: "nickname",
            },
            {
              title: "认证项目",
              dataIndex: "prove",
              key: "prove",
            },
            {
              title: "头像",
              dataIndex: "headImg",
              key: "headImg",
              scopedSlots: { customRender: "headImg" },
            },
            {
              title: "手机号",
              dataIndex: "phone",
              key: "phone",
            },
            {
              title: "状态",
              dataIndex: "reviewStatus",
              key: "reviewStatus",
              scopedSlots: { customRender: "reviewStatus" },
            },
            {
              title: "注册时间",
              dataIndex: "createTime",
              key: "createTime",
              scopedSlots: { customRender: "createTime" },
            },
            {
              title: "操作",
              dataIndex: "do",
              key: "do",
              scopedSlots: { customRender: "do" },
            },
          ],
      }
  },
  methods:{
    dataReset: (time) => {
      return moment(time).format("YYYY-MM-DD");
    },
    queryProve(value){
      console.log(value);
    },
    //=======初始化数据=======
    getProveList(){
        console.log('index');
        
      getProveList({
        pageNumber: 1,
        pageSize: 47,
      }).then((res)=> {
        let list = res.data.data.content;
        console.log("========认证信息=======", list);
        this.list = list;
      })
    },
  },
  mounted(){
      this.getProveList();
  },
}
</script>

<style>
    .head-img{
        width: 35px;
    }
</style>